﻿{extend name="public:layer_new_page_base"}
{block name="content"}
<!-- /.aside -->
<section id="content">
    <section class="vbox">
        <section class="scrollable padder">
            {include file="public:mylocal" /}
            <section class="panel panel-default">
                {include file="public:table_form_header" /}
                <div class="panel-body">
                    <form id="ajaxform_close" class="form-horizontal" method="post">
                        {foreach name="console_menu" item="vo" key="vi" }
                        <div style="width: 95%;padding-left: 5%;min-height: 120px;padding-bottom:6px">
                            {$vo.menu}
                            <input type="checkbox" name="pws[]"  value="{$vi}"  > {eq name="id" value="0"} {$vi} {/eq}

                            {if condition="isset($vo.son_menu)"}
                            <ul style="width: 85%;list-style-type: none">
                                {foreach name="vo.son_menu" item="so" key="soi"}
                                <li  style="clear: both;margin-top: 15px;">
                                    {$so.menu}
                                    <input type="checkbox" name="pws[]"  value="{$vi}_{$soi}" > {eq name="id" value="0"} {$vi}_{$soi} {/eq}

                                    <!-- 子菜单下有孙菜单 -->
                                    {if condition="isset($so.sun_menu)"}
                                    <ul style="width: 85%;list-style-type: none">
                                        {foreach name="so.sun_menu" item="su" key="sui"}
                                        <li style="clear: both;">
                                            {$su.menu}
                                            <input type="checkbox" name="pws[]"  value="{$vi}_{$soi}_{$sui}"> {eq name="id" value="0"} {$vi}_{$soi}_{$sui} {/eq}
                                        </li>

                                        <!-- 孙菜单下操作 -->
                                        {if condition="isset($su.handle)"}
                                        <ul style="width: 85%;list-style-type: none;">
                                      
                                            {foreach name="su.handle" item="suho" }
                                            <li style="float: left;margin-right: 15px;">
                                                {$suho.action}
                                                <input type="checkbox" name="pws[]"  value="{$vi}_{$soi}_{$sui}_{$key}"> {eq name="id" value="0"} {$vi}_{$soi}_{$sui}_{$key} {/eq}
                                            </li>
                                            {/foreach}
                                        </ul>
                                        {/if}

                                        {/foreach}

                                    </ul>
                                    {/if}

                                    <!-- 子菜单下直接是操作 -->
                                    {if condition="isset($so.handle)"}
                                    <ul style="width: 85%;list-style-type: none;">
                                        {foreach name="so.handle" item="ho" }
                                        <li style="float: left;margin-right: 15px;">
                                            {$ho.action}
                                            <input type="checkbox" name="pws[]"  value="{$vi}_{$soi}_{$key}" > {eq name="id" value="0"} {$vi}_{$soi}_{$key} {/eq}
                                        </li>
                                        {/foreach}
                            
                                    </ul>
                                    {/if}
                                </li>
                                {/foreach}
                            </ul>
                            {/if}
                        </div>
                        <div class="line line-dashed line-lg pull-in"></div>
                        {/foreach}

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <input type="hidden" name="id" value="{$id}" readonly required>
                                <button type="reset"  class="btn btn-default" style="padding:6px 12px;font-size: 14px;">重 置</button>
                                <button type="submit" class="btn btn-primary" style="padding:6px 12px;font-size: 14px;">保 存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </section>
        </section>
    </section>
</section>
<script type="text/javascript" src="__STATIC__/common/js/jquery.min.js"></script>        
<script type="text/javascript">
    var powers_arr = {:$admin_powers};
    $("input[name='pws[]']").each(function(){
        var  val = $(this).val();
        if( $.inArray(val,powers_arr) != -1 ){
            $(this).prop('checked','checked');
          }
    });

</script>
{/block}
{/extend}
